// pages/workerCode/my.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    info:{face:'',uname:''},
    defalut_face:('/static/defalut_face.png'),
    top: 0, //标题图标距离顶部距离
    opacity: 1,
    scrollTop: 0.5,
    ver:''
  },
  onShow: function() {
    this.setData({
      ver:'v'+wx.util.ver
    })
    this.load();
  },
  async load(){
    let res=await wx.util.post("user/index");
    this.setData({
      info:res.data
    })
  },
  toPage(e){
    let s=e.currentTarget.dataset.val;
    if(!wx.util.isLogin()){
      wx.setStorageSync("sf","user");
      wx.switchTab({
        url:"/pages/my/my"
      })
      return;
    }
    let url="/pages/workerCode/"+s;
    wx.navigateTo({
      url:url
    })
  },
  qiehuan(){
    wx.setStorageSync("sf","user");
    wx.removeStorageSync("worker_token");
    wx.switchTab({
      url:"/pages/index/index"
    })
  },
  initNavigation(e) {
    this.setData({
      opacity: 1,
      top: e.top
    })
  },
  opacityChange(e) {
    // this.opacity = e.opacity;
  },
  back() {
    wx.navigateBack();
  }
})